﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VisionCore
{
    public class WaferResult_ToMotion
    {
        public string ID = "";
        
        public List<Die> Dies = new List<Die>();
        public class Die
        {
            /// <summary>
            /// 夹爪1取料位置
            /// </summary>
            public Point Jaw1 = new Point();
            /// <summary>
            /// 夹爪2取料位置
            /// </summary>
            public Point Jaw2 = new Point();
            /// <summary>
            /// 对位位置
            /// </summary>
            public Point Locate = new Point();
            /// <summary>
            /// 精定位相机定位位置
            /// </summary>
            public bool Taked = false;
            public bool CCD_JingPass = false;
        }

        public class Point
        {
            public double x, y, r;
            public double StageR = 0;
            public string name = "";
            public int index = 0;
            public override string ToString()
            {
                return $"编号{index} {name} 位置{x:f3},{y:f3},{r:f3}";
            }
            public Point(double x, double y)
            {
                this.x = x;
                this.y = y;
            }
            public Point()
            {
                this.x = 0;
                this.y = 0;
            }
            public static Point operator +(Point a, Point b)
            {
                return new Point(a.x + b.x, a.y + b.y);

            }
            public Point Rotate_Rad(double _rad)
            {
                double rad = _rad * -1;
                Point point = new Point(0, 0);
                point.x = Math.Cos(rad) * x + Math.Sin(rad) * y;
                point.y = Math.Cos(rad) * y - Math.Sin(rad) * x;
                return point;
            }
        }
    }
}
